<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
 <%@ taglib prefix="s" uri="/struts-tags"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>龙翔收银系统</title>

		<link href="css/jquery.bxslider.css" rel="stylesheet" type="text/css">
		<link href="css/font-awesome.css" rel="stylesheet" />
		<link href="css/index.css" rel="stylesheet" />
            
        <style type="text/css"> 
		.shouyin{ width:99%; height:400px; background-color:background-color:#FAF7F7;; margin-left:10px; }
		.shouyin .left{width:70%; height:400px; float:left;background-color:#fff; }
		.shouyin .right{ width:28%; height:400px; float:left;}
		 </style>
	</head>
	<body>
		<div class="mainlayout">


<!-- 内容 -->
				<div class="r_financial_management">
					<!-- 处理 -->
						<ul class="hides"  >
							<li>
                            
                            <div class="shouyin"> 
                            <div class="left">
                            
								<!-- 处理查询后内容 -->
								<div>
									<table  cellspacing="0" cellpadding="4" class="banking_processing_con">
								
										<tr>
											<td colspan="3" class="table_tdheight"><span>菜色项目 </span></td>
                                            
										</tr>
										<tr height="15">
                                   
											<td colspan="5" align="center"> 
											 <form action="<%=path %>/greens/greens_findGreensSort" method="post"  >
                         
                                              快速查找：
                                           <select id="rpBankNo" name="s" onchange="setAccountName()" style="width: 20%;">
								      			<option value="">请选择</option>
                                                <option value="1">菜名</option>
                                                <option value="2">拼音码</option>
                                                <option value="3">类别</option>
                                                
								  			</select>  <input name="greens.name" type="txt"  style=" height:20px;width: 20%;"  >
                                            <input  type="submit" class="buttonstyle" value="查 询" >
                                            </form>
                                            </td>
                                           
                                            <td>
                                           
                                            </td>
                                            
										</tr>
										<tr>
											<td width="2"></td>
											<td align="center" valign="top">
												<table class="banking_processing_con_tit" border="0" class="table_1" cellspacing="0" cellpadding="4">
													<tr align="center">
														<th  align="center">助记编号</th>
														<th align="center">菜名</th>
														<th align="center">拼音码</th>
                                                        <th align="center">单价</th>
                                                        <th align="center">单位</th>
                                                         <th align="center">类别</th>
                                                         <th align="center">时间</th>
                                                          <th align="center">操作</th>
													</tr>
                                                  <!--start-->
                                                  
                                               
                                                  <s:iterator id="g" value="#request.greenlist">
                                                    <tr class="tr_addcolor">
                                                    <td align="center"> <s:property value="#g.codeid"/></td>
                                                    <td align="center"> <s:property value="#g.name"/></td>
                                                   <td align="center"> <s:property value="#g.code"/></td>
                                                   <td align="center"> <s:property value="#g.price"/></td>
                                                   <td align="center"> <s:property value="#g.unit"/></td>
                                                   <td align="center"> <s:property value="#g.category"/></td>
                                                   <td align="center"> <s:property value="#g.time"/></td>
                                                   <td align="center"> <a href="<%=path %>/greens/greens_updateGreens?greens.codeid=<s:property value="#g.codeid"/>&s=null">修改</a>&nbsp;&nbsp;
                                                   <a href="<%=path %>/greens/greens_deleteGreens?greens.codeid=<s:property value="#g.codeid"/>">删除</a></td>
                                                  
                                                    </tr>
                                                    </s:iterator>
                                                     <!--end-->
                                                    <!-- 分页 -->
													<tr class="fenye_style">
														<td colspan="3" class="gigantic pagination">
														
                                                  
                                                 
															<a href="<%=path %>/greens/greens_findGreensPage?pages=1" class="fa fa-angle-double-left" data-action="first"></a>
															<s:if test="#request.countpage==1"><a href="<%=path %>/greens/greens_findGreensPage?pages=1" class="fa fa-angle-left" data-action="previous"></a>
															</s:if><s:else>
															<a href="<%=path %>/greens/greens_findGreensPage?pages=<s:property value="#request.pages+1"/>" class="fa fa-angle-left" data-action="previous"></a>
															</s:else><input type="text" value=<s:property value="#request.countpage"/> >
															<s:if test="#request.countpage==#request.pages">
															<a href="<%=path %>/greens/greens_findGreensPage?pages=<s:property value="#request.countpage"/>" class="fa fa-angle-right" data-action="next"></a>
															</s:if><s:else>
															<a href="<%=path %>/greens/greens_findGreensPage?pages=<s:property value="#request.countpage+1"/>" class="fa fa-angle-right" data-action="next"></a>
															</s:else>
															<a href="<%=path %>/greens/greens_findGreensPage?pages=<s:property value="#request.pages"/>" class="fa fa-angle-double-right" data-action="last"></a>
														</td>
													</tr>
													<tr class="tr_addcolor">
														<td class="td_3" align="center" colspan="3"><font color="#A63E19">总菜数:</font><s:property value="#request.count"/></td>
                                                        <td class="td_3" align="center" colspan="3"><font color="#A63E19"></font></td>
													</tr>
												 </table>
											</td>
											<td width="2"></td>
										</tr>
                                        
									</table>
                                   
								</div>
                            </div>
                            <div class="right">
                            
                            <s:if test="#request.updatelist!=null"> 
                            <table  cellspacing="0" cellpadding="4" class="banking_processing_con">
								
										<tr>
											<td colspan="3" class="table_tdheight"><span>修改菜品 </span></td>
										</tr>
										
									</table>
                           
                           <form action="<%=path %>/greens/greens_updateGreens" method="post" onsubmit="return confirmation()" >
                            <table class="banking_processing_tit">
                            
                             <s:iterator id="u" value="#request.updatelist">
                            <input  name="greens.codeid" type="hidden" value="<s:property value="#u.codeid"/>">
                            <input  name="s" type="hidden" value="<s:property value="#u.codeid"/>">
							
										  <tr>
											<td style="width:120px">菜名：</td>
											<td colspan="5" style="text-align:left;">
											 <input id="name" name="greens.name" value="<s:property value="#u.name"/>" type="txt" style=" height:20px;width: 60%;"   >
											 <p id="textname"><p>
											</td>
										</tr>
                                          <tr>
											<td style="width:120px">拼音码：</td>
											<td colspan="5" style="text-align:left;">
											 <input id="code" name="greens.code" value="<s:property value="#u.code"/>" type="txt" style=" height:20px;width: 60%;"   >
											  <p id="textcode"><p>
											</td>
										</tr>
                                          <tr>
											<td style="width:120px">单价：</td>
											<td colspan="5" style="text-align:left;">
											 <input id="price" name="greens.price" value="<s:property value="#u.price"/>" type="txt" style=" height:20px;width: 60%;"   >
											  <p id="textprice"><p>
											</td>
										</tr>
                                        <tr>
											<td style="width:120px">单位：</td>
											<td colspan="5" style="text-align:left;">
											 <input id="unit" name="greens.unit" value="<s:property value="#u.unit"/>" type="txt" style=" height:20px;width: 60%;"   >
											  <p id="textunit"><p>
											</td>
										</tr>
                                        <tr>
											<td style="width:120px">类别：</td>
											<td colspan="5" style="text-align:left;">
											 <select id="rpBankNo" name="greens.category" onchange="setAccountName()" style=" height:20px;width: 60%;"">
								      			<option value="<s:property value="#u.category"/>"><s:property value="#u.category"/></option>
                                                	<s:iterator id = "c" value="#request.categorylist">
								      			 <option value="<s:property value="#c.category"/>"><s:property value="#c.category"/></option>
								      			</s:iterator>
								  			</select>
											 <p id="textrpBankNo"><p>
											
											</td>
										</tr>
                                        
                                          <tr>
											<td style="width:120px">时间：</td>
											<td colspan="5" style="text-align:left;">
											<input id="trxDate" name="greens.time" style="width: 60%;" placeholder="<s:property value="#u.time"/>" value="" onfocus="WdatePicker()" name="trxDate" maxlength="10" size="12" readonly onclick="SelectDate( this, 'yyyy-MM-dd ' )">
											<p id="texttime"><p>
											</td>
										</tr>
                                        	
										<tr>
											<td colspan="6">
												<input name="Submit" type="submit" class="buttonstyle" value="修改" >
												<input name="add" type="button" class="buttonstyle" value="清空">
											</td>
										</tr>
										</s:iterator>
										
									</table>
									</form>
									</s:if><s:else>
									
									 <table  cellspacing="0" cellpadding="4" class="banking_processing_con">
								
										<tr>
											<td colspan="3" class="table_tdheight"><span>添加菜品 </span></td>
										</tr>
										
									</table>
                           
                           <form action="<%=path %>/greens/greens_addupGreens" method="post" onsubmit="return confirmation()" >
                            <table class="banking_processing_tit">

										  <tr>
											<td style="width:120px">菜名：</td>
											<td colspan="5" style="text-align:left;">
											  <input  name="greens.codeid" value="0" type="hidden" style=" height:20px;width: 60%;"   >
											
											 <input id="name" name="greens.name" type="txt" style=" height:20px;width: 60%;"   >
											 <p id="textname"><p>
											</td>
										</tr>
                                          <tr>
											<td style="width:120px">拼音码：</td>
											<td colspan="5" style="text-align:left;">
											 <input id="code" name="greens.code"  type="txt" style=" height:20px;width: 60%;"   >
											  <p id="textcode"><p>
											</td>
										</tr>
                                          <tr>
											<td style="width:120px">单价：</td>
											<td colspan="5" style="text-align:left;">
											 <input id="price" name="greens.price"  type="txt" style=" height:20px;width: 60%;"   >
											  <p id="textprice"><p>
											</td>
										</tr>
                                        <tr>
											<td style="width:120px">单位：</td>
											<td colspan="5" style="text-align:left;">
											 <input id="unit" name="greens.unit"  type="txt" style=" height:20px;width: 60%;"   >
											  <p id="textunit"><p>
											</td>
										</tr>
                                        <tr>
											<td style="width:120px">类别：</td>
											<td colspan="5" style="text-align:left;">
											 <select id="rpBankNo" name="greens.category" onchange="setAccountName()" style=" height:20px;width: 60%;"">
								      			<option value="">请选择</option>
                                                	<s:iterator id = "c" value="#request.categorylist">
								      			 <option value="<s:property value="#c.category"/>"><s:property value="#c.category"/></option>
								      			</s:iterator>
								  			</select>
											 <p id="textrpBankNo"><p>
											
											</td>
										</tr>
                                        
                                          <tr>
											<td style="width:120px">时间：</td>
											<td colspan="5" style="text-align:left;">
											<input id="trxDate" name="greens.time" style="width: 60%;" value="<s:property value="#u.code"/>" onfocus="WdatePicker()" name="trxDate" maxlength="10" size="12" readonly onclick="SelectDate( this, 'yyyy-MM-dd ' )">
											<p id="texttime"><p>
											</td>
										</tr>
                                        	
										<tr>
											<td colspan="6">
												<input name="Submit" type="submit" class="buttonstyle" value="添加" >
												<input name="add" type="button" class="buttonstyle" value="清空">
											</td>
										</tr>
										
									</table>
									</form>
									
										</s:else>
                            <div>
									
								</div></div>
                            </div>
								
								
								
							</li>
						</ul>
                       </div>
                     
                       <script type="text/javascript" src="js/adddate.js"></script>
	
                  <script src="js/jquery-1.10.2.js"></script>
<script type="text/javascript">
			function confirmation(){
			
					
						if($("#name").val() == null  || $("#name").val() == ""){
							$("#textname").html("菜名不能为空！1-20个字符或数字");
							
							return false;
						}
						 if($("#code").val() == null || $("#code").val() == ""){
							$("#textcode").html("拼音码不能为空！1-10个字符");
							
							return false;
						}
						
						 if($("#price").val() == null || $("#price").val() == ""){
							$("#textprice").html("单价不能为空！1-1000之间的纯数字");
							
							return false;
						}
						
						
						 if($("#unit").val() == null || $("#unit").val() == ""){
							$("#textunit").html("拼音码不能为空！1个字符");
							
							return false;
						}
						
						
						 if($("#trxDate").val() == null || $("#trxDate").val() == ""){
							$("#texttime").html("时间不能为空！");
							
							return false;
						}				
						
						return true;
							
					}
				
				
			</script>                 
                  </div>
                 
                      
</body>
</html>
